package com.tuniu.agents.advisor;

import java.util.Map;

/**
 * Interface for storing global environment variables for the agent.
 */
public interface ChatEnvironmentMemory {

    /**
     * Adds a message to the conversation memory.
     *
     * @param conversationId The ID of the conversation.
     * @param message        The message to be added.
     */
    void add(String conversationId, Map<String, Object> message);

    /**
     * Retrieves the message associated with the given conversation ID.
     *
     * @param conversationId The ID of the conversation.
     * @return A map containing the message.
     */
    Map<String, Object> get(String conversationId);

    /**
     * Retrieves a specific value from the message associated with the given conversation ID.
     *
     * @param conversationId The ID of the conversation.
     * @param key            The key of the value to retrieve.
     * @return The value associated with the key.
     */
    Object get(String conversationId, String key);

    /**
     * Checks if a conversation exists in memory.
     *
     * @param conversationId The ID of the conversation.
     * @return True if the conversation exists, false otherwise.
     */
    Boolean exist(String conversationId);

    /**
     * Clears a specific key from the conversation memory.
     *
     * @param conversationId The ID of the conversation.
     * @param key            The key to be cleared.
     */
    void clear(String conversationId, String key);

    /**
     * Clears all data associated with the given conversation ID.
     *
     * @param conversationId The ID of the conversation.
     */
    void clear(String conversationId);

}
